<?php

namespace web\controllers\base;

/**
 * 控制器-页面
 *
 * @author peng.huang
 */
class PageBaseController extends \application\controllers\base\BaseController {

    /**
     * 初始化
     */
    public function init() {
        // 防止CSRF
        if (FALSE === $this->request->validateCsrfToken()) {
            $this->response->toErrorPage('非法请求', 400);
        }

        // 禁止缓存
        $this->response->setHeaders(
                array('Content-type' => 'text/html;charset=utf-8',
                    'Cache-Control' => 'no-cache, must-revalidate',
                    'Last-Modified' => gmdate('D, d M Y H:i:s') . ' GMT',
                    'Pragma' => 'no-cache',
                    'Expires' => -1
                )
        );

        // 加载公共的js和css
        $this->addJs('web/js/jquery/jquery-2.1.1.min');
        $this->addCss('web/css/c');
    }

}
